# coding=utf-8

import requests
from lxml import etree

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36",
    "Referer": "https://movie.douban.com/cinema/nowplaying/zhanghuaxian/"
}

url = "https://movie.douban.com/cinema/nowplaying/zhanghuaxian/"

response = requests.get(url, headers=headers)
text = response.text

html = etree.HTML(text)

ul = html.xpath("//ul[@class='lists']")[0]
lis = ul.xpath("./li")
movices = []
for li in lis:
    title = li.xpath("@data-title")[0]
    score = li.xpath("@data-score")[0]
    movice = {
        "title": title,
        "score": score
    }
    movices.append(movice)

for m in movices:
    print(m)
